<template>
  <view>
    <view class='productList'>

        <uv-sticky :offsetTop="0" :customNavHeight="0" bgColor="#fff">
          <view class="heightWrapper">
          <view class="search">
            <view class="order-total-text">
              数量：{{ dataPage.total }}
            </view>

            <view @click="filterCondition" class="total-search">
              <view class="school-class">筛选</view>
              <uv-action-sheet
                  ref="actionSheet"
                  :actions="schools"
                  title="学校筛选"
                  @select="selectSchool">
              </uv-action-sheet>
            </view>
          </view>
          </view>
        </uv-sticky>

      <PageBody :properties="pageBody" @scrolltolower="scrolltolower">
        <template v-slot:body>
          <uv-gap height="10" v-if="datas.length > 0" bgColor=""></uv-gap>
          <view v-if="datas.length > 0" v-for="(item,index) in datas">
            <view @click="toDetail(item.memberId)" class="student-wrapper">
              <view class="student-item">
                <view class="avatar-line">
                  <view class="avatar">
                    <uv-avatar v-if="item.avatar" :size="50" :src="item.avatar"></uv-avatar>
                    <uv-avatar v-else :text="item.realName ? item.realName : item.nickName" fontSize="12" randomBgColor></uv-avatar>
                  </view>
                  <view>
                    <view>姓名：{{ item.realName ? item.realName : item.nickName }}（性别：{{
                        (item.sex === null || item.sex === '0') ? '未知' : item.sex === '1' ? '男' : '女'
                      }}）
                    </view>
                    <view>联系电话：{{ item.phone }}</view>
                  </view>
                </view>
                <view>
                  <view class="item-line">
                    <view>用户ID：{{ item.memberId }}</view>
                  </view>

                  <view class="item-line">
                    <view>注册时间：{{ item.registerTime }}</view>
                  </view>

                </view>
                <view :style="{display: 'flex','justify-content': 'space-between',color:themConfig.theme.color,'font-size':'17px','margin-top':'10px'}" >
                  <view>
                    共订单数量：{{item.orderMemberInfo.count}}
                  </view>
                  <view>
                    共消费金额：{{item.orderMemberInfo.amount}}
                  </view>
                </view>
              </view>
            </view>
          </view>

          <Empty :show="datas.length<=0"/>

          <uv-load-more v-if="isReachBottom" @loadmore="loadmore" :status="loading.status" :loading-text="loading.loadingText"
                        :loadmore-text="loading.loadmoreText"
                        nomore-text=" "/>
          <uv-gap height="1" v-if="datas.length > 0" bgColor=""></uv-gap>

        </template>
      </PageBody>
    </view>

    <!--    搜索条件-->
    <uv-popup @close="clearForm" mode="top" closeable
              closeIconPos="bottom-right"
              :closeOnClickOverlay="false"
              custom-style="border-radius:10px" ref="popup">
      <view style="padding: 30rpx">
        <view style="margin-top: 10rpx">

          <view class="search-item">
            <view class="field">ID：</view>
            <view class="field-value">
              <uv-input placeholder="用户ID" v-model="searchForm.id" clearable border="bottom"></uv-input>
            </view>
          </view>
          <view class="search-item">
            <view class="field">手机号：</view>
            <view class="field-value">
              <uv-input placeholder="手机号" v-model="searchForm.phone" clearable border="bottom"></uv-input>
            </view>
          </view>

          <view class="search-btn">

            <view class="btn">
              <uv-button :customTextStyle="{color:themConfig.theme.color}" :iconColor="themConfig.theme.color"
                         text="清空" @click="clearForm" type="default"></uv-button>
            </view>
            <view class="btn">
              <uv-button :customTextStyle="{color:themConfig.theme.color}" :iconColor="themConfig.theme.color"
                         text="搜索" @click="submitSearchForm" type="default"></uv-button>
            </view>
          </view>
        </view>
      </view>
    </uv-popup>

  </view>
</template>
<script>
import {mixins} from './index.js'

export default {
  mixins: [mixins]
}
</script>

<style scoped lang="scss">
@import './index.scss';
</style>
